<?php 

$auth = $_SESSION['auth'];
if (empty($auth)) die('用户未登录！^_^');

if (empty($_POST)) die();

$name = filter_var($_POST['name'], FILTER_SANITIZE_STRING);
$auto_bg_url = empty($_POST['auto_bg_url']) ? 0 : 1;
$background_url = filter_var($_POST['background_url'], FILTER_SANITIZE_URL);
$auto_intro = empty($_POST['auto_intro']) ? 0 : 1;
$intro = filter_var($_POST['intro'], FILTER_SANITIZE_STRING);
$ext = intval($_POST['ext']);

?>
<div class="container">
	<div class="row clearfix">
		<ol class="breadcrumb forum-breadcrumb">
			<li><a href="?c=forum"><span class="glyphicon glyphicon-home"></span> 首页</a></li>
			<li class="active"><span class="glyphicon glyphicon-edit"></span> 付费开通频道</li>
		</ol>
	</div>
</div>
<div class="container">
	<div class="forum-add">
		<div class="row clearfix">
			<div class="col-md-12 column">
				<h3><span class="glyphicon glyphicon-edit"></span> 付费开通频道</h3>
				<hr>
				<div class="alert alert-danger" role="alert">
					<b>付费开通频道：</b>
					<ol>
						<li>您将拥有该频道包括编辑、无限发步、删除在内的最高管理权限。</li>
						<li>开通频道的统一支付金额为500元。</li>
						<li>您可以有偿或无偿的转让该频道。</li>
					</ol>
				</div>
				<hr class="solid">
				<div class="col-md-11 column">
					<form class="form-horizontal" id="do_forum_add" action="javascript:do_pay_forum_add()">
						<fieldset>
							<!-- Text input-->
							<div class="form-group">
								<label class="col-md-2 control-label">名称</label>  
								<div class="col-md-7">
									<input name="name" type="text" placeholder="某某频道" class="form-control input-md" required="" value="<?php echo $name ?>">
								</div>
							</div>
							<!-- Text input-->
							<div class="form-group">
								<label class="col-md-2 control-label">描述</label>  
								<div class="col-md-7">
									<div class="checkbox"><label><input name="auto_intro" type="checkbox" onclick="check_auto_intro()" <?php if (1 == $auto_intro) echo 'checked="checked"' ?>> 自动更新 </label></div>
									<textarea id="forum_intro" name="intro" type="text" rows="3" placeholder="简单的介绍" class="form-control input-md" style="margin-top:10px;<?php if (1 == $auto_intro) echo 'display:none' ?>"><?php echo $intro?></textarea>
								</div>
							</div>
							<!-- Text input-->
							<div class="form-group">
								<label class="col-md-2 control-label">图标URL</label>  
								<div class="col-md-2">
								<div class="checkbox"><label><input name="auto_bg_url" type="checkbox" onclick="check_auto_bg_url()" <?php if (1 == $auto_bg_url) echo 'checked="checked"' ?>> 自动更新 </label></div>
								</div>
								<div class="col-md-5">
									<input id="forum_bg_url" name="background_url" type="text" placeholder="http://xxx/xxx/xx.jpg" class="form-control input-md" value="<?php echo $background_url ?>" <?php if (1 == $auto_bg_url) echo 'style="display:none"' ?>>
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-2 control-label">类型</label>  
								<div class="col-md-7">
									<?php require_once('forum_ext/forum_ext.php'); ?>
									<?php foreach ($forum_ext as $key => $f_e) { ?>
									<label class="radio-inline"> <input type="radio" name="ext" value="<?php echo $key ?>" <?php if ($key == $ext) echo 'checked="checked"' ?>> <?php echo $f_e['name'] ?> </label>
									<?php } ?>
								</div>
							</div>
							<!-- Text input-->
							<div class="form-group">
								<label class="col-md-2 control-label">支付金额（元）</label>  
								<div class="col-md-7">
									<input name="pay" type="text" class="form-control input-md" required="" disabled="disabled"  value="500">
								</div>
							</div>
							<!-- Text input-->
							<div class="form-group">
								<label class="col-md-2 control-label">密码</label>  
								<div class="col-md-7">
									<input id="password" name="password" type="password" placeholder="密码" class="form-control input-md" required="">
								</div>
							</div>
							<!-- token -->
							<input type="hidden" name="token" value="<?php echo get_token() ?>"/>
							<!-- Button -->
							<div class="form-group">
								<label class="col-md-2 control-label"></label>
								<div class="col-md-3">
									<button class="btn btn-danger btn-block">确认付费开通</button>
								</div>
								<div class="col-md-6">
								</div>
							</div>
						</fieldset>
					</form>	


				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">

$(document).ready(function(){
	$('li#forum_add').addClass('active');
});

</script>
